package com.thoughtworks;

import java.util.ArrayList;
import java.util.List;

public class HalfPrice extends Discounts {
    HelperFunctions helper = new HelperFunctions();
    @Override
    public int applyDiscounts(String[] ids, int[] numbers) {
        List halfDishes = DataProvider.getHalfDishIds();
        int money = 0;
        for(int i=0;i<ids.length;i++){
            if(halfDishes.indexOf(ids[i])>=0){
                money += 0.5*helper.findItemPrice(ids[i])*numbers[i];
            } else{
                money += helper.findItemPrice(ids[i])*numbers[i];
            }
        }
        return money;
    }
}
